package academic.concordia.bankofquebec.bean.utils;

import java.util.Calendar;
import java.util.Date;

import academic.concordia.bankofquebec.entity.InvestmentAccount;

public class InvestmentAccountUtils {
	
	public static Date calculateInterestPaymentDate(InvestmentAccount account){
		account.getInterestPaymentDate();
		account.getPeriodicity();
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(account.getInterestPaymentDate());
		calendar.set(account.getTimePeriod(), calendar.get(account.getTimePeriod())
								  + account.getPeriodicity());
		calendar.set(Calendar.HOUR, 0);
		calendar.set(Calendar.MINUTE, 0);
		calendar.set(Calendar.SECOND, 0);
		calendar.set(Calendar.MILLISECOND, 0);
		return calendar.getTime();
	}
	
	
	public static Date  today(){
		Calendar today = Calendar.getInstance();
		today.setTime(new Date());
		today.set(Calendar.HOUR, 0);
		today.set(Calendar.MINUTE, 0);
		today.set(Calendar.SECOND, 0);
		today.set(Calendar.MILLISECOND, 0);
		return today.getTime();
	}
}
